package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092000557035";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCENMp/gUhWqBj28vXvmqlOJJsOU5Be5CmhMzVWrNN9QhLoHHdzp+p0WMTfZWs/9lE4P+q54erXPUAkyFdHilrW4jQEyLxn5ZCRGieLyhtrBL519DumcOwLzS434rOOGXHn4lxotYYsVo0QskoR68u0o+yo19igqZFsItmCmf89djhmRmy4BU0YpiAYW/vUxbpvjUbOvXQBRgBXIwlIRipWhxAuYTjw7E0hGMy6J/e/WMt26oiEuoCc7pjRip+zpHzmcGIKPCefHOTFx0JamsFzPgSx+wCW2F4/a873ofuWPx50DCBmKCTP4Rt7sU5GVNvfGMkk8W58J7SlUooe+hYFAgMBAAECggEAYns8uPxiGYNAjXxw7VplcftcsbBX5AfMZvNRcU5ugGke0l6aMMJNqPuTM+JFoTDoUaFzRaJfoJRU2tGOCpGql1WLcGDjz/U22pAEE2KrR+4RvqX/ZT3K6AOgwSqTnG+h5R0+vxUxbIfQrzZQbMccSGSv3xpimVOXK1lOc7YpZus0GhpyEH+CKIcClsBRqdwrmzJEYn3C3eZC2VbycEvH4o9F2nKZcXj33QU3O07EaV9tJdQESe2kKU0eOMftlYHey/b8shQbV8mMUwKxUR+9ggrcETFUZiMWu6rmCnVHglrqP7rds0zpS2N7OMOhqT86/XbC6bWo+dUJKbFn+LCvIQKBgQDyKEqB0fAh7i3AemyFlgEZio1LsLyms2qwR5sk5pktKZxHYT/PQUi1GIj64qfGPN4S9H/KK/nFVb+8WGwFQYfQf6cGSwgr7J0OSqDkeVV8nnMXJ8K3lFgo34ATm18C7gzFHvGIMxsjVrJE45TvNl+iHSA5suyAHcWwKZwcLl9sPQKBgQCLw3wPlyDNIgAgPatKH1ZWUdY/SzxkLVAIKgjMP36/ZqgMgZh4UkJsY4wvM2OQOpI4ktsI8jWkl+qCj/tjjP1Zq4TauKuVO5hs+haAmGQgLCtQkJAXLMeNSLajqrE9R7PCTk6nP5ide1w/M+Fli1y7oPT3YFAf3j5tbhdhM7eFaQKBgB1TtdpNE5j4YIAcE4KGLTHrrrsI93/04Knisi5g4xIuJOgcJf8yt9x+0TAZPRpsCrUe+U8BzmkQvnzP9J0aV5lvrEm90oqHSGoPrbad3zWNdwDJ5vIWvCqPDtLREUuoitFgsv28ur+n40UmjsX9vs1CW8HBIpVNhcCU+XwMPbA9AoGAE3HpKsod+CxI1DOAR1nAy1WrdzbiehWL0vb2LmSPH9YKf2LwcZ0QPMBE2rRNn91mRpS4ALCiIfo42F1r3lfZT8Z7P2r+BE88T70jsFSDaa57gEP8qBzEzrVVI8Q10I7PRbNbYg2JEC//j5OKQnR3PGuSaXBu9WAYU2VDv3RQjjECgYAlQceuQLO9bLjrlEu9LfEdg06gHjle1tLEWkXHqWY/YH5B8nuq3iqimXvRh/KnytND4pfHTp7Iv1iNFENywTlBqALtzRAcBDHIvY5ZvSdaFHd3bwnUT1Kg5g3a+F6HiumawY1EElQZVYcWmplyB+2D/e3Ak607QXAejCNj7IuBCA==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8WkpJ/0OIW6tmX256c1w4Q6h/RhnOvQTjsMR/c4kEcL0O1EzMLW+t3hrsDG7uca0MNJn/pzBS6TWrevi9dsg1GqU5o7UVaoJMnNRDttl1TncSAc/+Juq8ii0Dp+l8py38o9O+AYQPnsyaDB10tNSZM37l+LL2feqwSrpLw7cZUkAIk81EkfNV6b7qyNKP/2cBWuK7ZkguBYyei/IZzkZVW0oGDfqke0sM0RLViN5w2IbAS88tv1wqHAZKmWuEVSRXTcBOYKtNDxg/lXBrsQIZvmuJ3xD52u9r2SXrgJMsEW+cmSR30ywxvCpNRrQleei67KlOI71Yr2lblnIKNLyvwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/client/pay.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/client/paysuccess.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

